package com.wc.AlgoOJ.CT0205;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/1/19 1:16
 * @description blg玩贪吃蛇Ⅰ
 * http://43.138.190.70:8888/p/CT0205
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int t, n, m;
    static String s;

    public static void main(String[] args) {
        int t = sc.nextInt();
        int[] posX = new int[128];
        int[] posY = new int[128];
        posX['w'] = -1;
        posY['w'] = 0;
        posX['s'] = 1;
        posY['s'] = 0;
        posX['a'] = 0;
        posY['a'] = -1;
        posX['d'] = 0;
        posY['d'] = 1;
        while (t-- > 0) {
            int x = 0;
            int y = 0;
            n = sc.nextInt();
            m = sc.nextInt();
            String s = sc.next();
            boolean flg = true;
            for (char c : s.toCharArray()) {
                x += posX[c];
                y += posY[c];
                if (x < -n || x > n || y < -m || y > m) {
                    flg = false;
                    break;
                }
            }
            if (flg) {
                out.println("alive");
            } else {
                out.println("died");
            }
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}